package com.example.test.fragment;

import com.example.test.R;
import com.example.test.demin.Bill;
import com.example.test.utils.DbDaoUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class BillDetailFragment extends BaseFragment {

	@ViewInject(R.id.tv_carnumber)
	private TextView tv_carnumber;
	@ViewInject(R.id.tv_cost)
	private TextView tv_cost;
	@ViewInject(R.id.tv_tingname)
	private TextView tv_tingname;
	@ViewInject(R.id.tv_billnumber)
	private TextView tv_billnumber;
	@ViewInject(R.id.tv_billtime)
	private TextView tv_billtime;
	@ViewInject(R.id.tv_paysucess)
	private TextView tv_paysucess;
	private String fromwhat;
	private int ids;
	private DbDaoUtils dao;
	private Bill bill;
	public BillDetailFragment(String fromwhat, int ids) {
		
		// TODO Auto-generated constructor stub
		this.ids=ids;
		this.fromwhat=fromwhat;
	}

	@Override
	public void initData() {
		dao = new DbDaoUtils(ct);
       if(fromwhat.equals("pay")){
    	   tv_paysucess.setVisibility(View.VISIBLE);
       }
    	  bill = dao.findBillInfo(ids);
    	  tv_carnumber.setText(bill.getCarnumber());
    	  tv_billtime.setText(bill.getTime());
    	  tv_cost.setText(String.valueOf(bill.getCost()));
    	  tv_tingname.setText(bill.getTingname());
    	  tv_billnumber.setText(bill.getBillnumber());
       
	}

	@Override
	public View initView(LayoutInflater inflater) {
		// TODO Auto-generated method stub
		View view=inflater.inflate(R.layout.billitem_layout, null);
		ViewUtils.inject(this,view);
		return view;
	}

}
